﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace PSI.Models {
    /// <summary>
    /// 系统日志
    /// </summary>
    public class Log {
        public Log() {
            var user = PSI.Services.UserService.GetLoginUser();
            UserId = user.Id;
            LoginName = user.LoginName;
            UserName = user.Name;
            IP = PSI.Services.IPService.GetUserIP();
            LogContent = string.Empty;
        }

        [JsonProperty("userId")]
        public string UserId { get; set; }

        [JsonProperty("loginName")]
        public string LoginName { get; set; }

        [JsonProperty("userName")]
        public string UserName { get; set; }

        /// <summary>
        /// IP地址
        /// </summary>
        [JsonProperty("ip")]
        public string IP { get; set; }

        /// <summary>
        /// 日志内容
        /// </summary>
        [JsonProperty("content")]
        public string LogContent { get; set; }

        /// <summary>
        /// 日志记录的时间
        /// </summary>
        [JsonProperty("dt")]
        public string DT { get; set; }

        [JsonProperty("id")]
        public int Id { get; set; }
    }
}